Skip to content

Separate date validation contexts and render configured currency - #237

Merged
javedh-dev merged 5 commits into
javedh-dev:devfrom
black-dragon74:fix-date-validation
Aug 22, 2026
Merged

javedh-dev merged 5 commits into
javedh-dev:devfrom
black-dragon74:fix-date-validation

Conversation

@black-dragon74

@black-dragon74 black-dragon74 commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for this amazing project!!

This patch fixes date validation for configured formats like dd/MM/yyyy across forms, including invalid dates and date ranges. I have added regression tests around the same. Without this you could not set dates where day is above 12.

This patch also updates fuel “Total Spent” and charts to use the configured currency instead of always showing $.

Validate localized form dates strictly while keeping API dates ISO-safe.

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
Use configured date formats across maintenance, fuel, compliance, and reminder forms.

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
Format fuel spending with the user's currency and locale settings.

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
Format expense chart axes and tooltips with the user's currency settings.

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
@black-dragon74

Copy link
Copy Markdown
Contributor Author

@javedh-dev PTAL :)

@javedh-dev javedh-dev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check The comment below and add a test for same so it also is covered under that.

Comment thread src/lib/domain/compliance.ts Outdated
const endDate = new Date(data.endDate);
// Field-level form validation handles localized values; this comparison
// is for ISO API values only.
if (Number.isNaN(startDate.getTime()) || Number.isNaN(endDate.getTime())) return true;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refine is still comparing localized date strings with new Date(), not ISO ones. The NaN check doesn't save it — for day/month both ≤12 it'll parse fine, just as the wrong date (US order). So startDate: '10/03/2026' + endDate: '03/10/2026' (a totally valid range) gets rejected because it reads them backwards.

Can we drop this comparison from the schema the form uses, or give the form its own version that actually parses with dateFormat?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Fixed with: 9d263a6 :)

@javedh-dev javedh-dev added the Issue Issue in existing application label Aug 9, 2026
Signed-off-by: Niraj Yadav <niryadav@redhat.com>
@black-dragon74

Copy link
Copy Markdown
Contributor Author

Hey @javedh-dev, can we get this in?

@javedh-dev javedh-dev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@javedh-dev
javedh-dev merged commit 839aa27 into javedh-dev:dev Aug 22, 2026
1 check passed
@black-dragon74 black-dragon74 changed the title Seaprate date validation contexts and render configured currency Separate date validation contexts and render configured currency Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-review Issue Issue in existing application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants